<%--
  Created by IntelliJ IDEA.
  User: liaoh
  Date: 2017/6/13
  Time: 20:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>学生管理系统</title>
  <link rel="stylesheet" href="../../../resources/css/students.css" type="text/css"/>
</head>
<body>

<a href="/add">添加</a>

<table cellspacing="0" align="center">
  <tr><th colspan="5">学生管理系统</th></tr>
  <tr>
    <th>学号</th> <th>姓名</th> <th>密码</th> <th colspan="2">操作</th>
  </tr>
    <c:forEach items="${students}" var="students">
      <tr>
      <td>${students.id}</td> <td>${students.name}</td> <td>${students.password}</td>
        <td><a href="${students.id}/update">修改</a> </td> <td><a href="${students.id}/delete">删除</a></td>
      </tr>
    </c:forEach>

  <tr>
    <td colspan="5">

      <!--分页start---分页jsp，a标签传递controller路径和分页参数 -->
      <div>
        <!--  -->
        <!--判断总页数-->
        <c:if test="${page.total} == 0"> 共1页 </c:if>
        <c:if test="${page.total !=0 }"> 共${page.pages}页 </c:if>

        第${page.pageNum}页

        <c:if test="${!page.isFirstPage}">
          <a href="<c:url value="/students?pageNum=${page.firstPage}&pageSize=${page.pageSize}"/>">首页</a>
          <a href="<c:url value="/students?pageNum=${page.prePage}&pageSize=${page.pageSize}"/>">上一页</a>
        </c:if>

        <c:forEach items="${page.navigatepageNums}" var="navigatepageNums">
          <a href="<c:url value="/students?pageNum=${navigatepageNums}&pageSize=${page.pageSize}"/>">${navigatepageNums}</a>
        </c:forEach>

        <c:if test="${!page.isLastPage}">
          <a href="<c:url value="/students?pageNum=${page.nextPage}&pageSize=${page.pageSize}"/>">下一页</a>
          <a href="<c:url value="/students?pageNum=${page.lastPage}&pageSize=${page.pageSize}"/>">尾页</a>
        </c:if>
      </div>
      <!--分页end-->

    </td>
  </tr>
</table>
</body>
</html>
